import 'dart:io';
import 'package:flutter/services.dart' show rootBundle;

import '../base/network_core.dart';

class EchoNetwork extends NetworkCore {

//  Future<void> loadCert() async {
//    String cerData = await rootBundle.loadString('resource/pem/api.luckybamboo.top.pem');
//  }

  EchoNetwork() {
    print('EchoNetwork init');
    this.dio.options.baseUrl = 'https://api.luckybamboo.top';
//    this.dio.options.baseUrl = 'http://10.45.0.218:8085';
    //设置证书受信
    this.dio.onHttpClientCreate = (HttpClient client) {
      client.badCertificateCallback =
          (X509Certificate cert, String host, int port) {
        return true;
      };
    };
    //请求头
    Map<String, String> headers = new Map();
//    headers = {
//      'Authorization' : 'Bearer ' + 'token'
//    };
    this.dio.options.contentType = ContentType.parse('application/x-www-form-urlencoded');
    this.dio.options.headers.addAll(headers);
  }
}
